package com.boho.common;

import cn.boho.framework.context.ActionContext;
import cn.boho.framework.exception.UserOperationException;
import cn.boho.framework.service.MessageService;

public class SystemUtils {
	
	/**
	 * 取得session值
	 * @param atx
	 * @return
	 * @throws Exception
	 */
	public static String getSessionUser(ActionContext atx) throws Exception{
		Object sessionID = atx.getSessionValue(Constant.SESSION_USER_NO);
		if(sessionID == null){
			UserOperationException uoe = new UserOperationException();
			atx.setErrorContext("BOHO_COMMON_1010", MessageService.getMessage("BOHO_COMMON_1010"), uoe);
			throw uoe;
		}
		return sessionID.toString();
	}
	
}
